package com.itheima.test0909.test02;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class BigDecimalTest {
    public static void main(String[] args) {
        BigDecimal b1 = new java.math.BigDecimal("0.1");
        BigDecimal b2 = new java.math.BigDecimal("0.03");

        BigDecimal add = b1.add(b2);
        System.out.println(add);
        System.out.println("------------------");

        BigDecimal subtract = b1.subtract(b2);
        System.out.println(subtract);
        System.out.println("------------------");

        BigDecimal multiply = b1.multiply(b2);
        System.out.println(multiply);
        System.out.println("------------------");

        BigDecimal divideDOWN = b1.divide(b2,RoundingMode.DOWN);
        BigDecimal divideFLOOR = b1.divide(b2,RoundingMode.FLOOR);
        BigDecimal divideCEILING = b1.divide(b2,RoundingMode.CEILING);
        BigDecimal divideUP = b1.divide(b2,RoundingMode.UP);
        BigDecimal divideHALF_DOWN = b1.divide(b2,RoundingMode.HALF_DOWN);
        System.out.println(divideDOWN);
        System.out.println(divideFLOOR);
        System.out.println(divideCEILING);
        System.out.println(divideUP);
        System.out.println(divideHALF_DOWN);
        System.out.println("------------------");

    }
}
